<?php
// +----------------------------------------------------------------------
// | Tplay [ WE ONLY DO WHAT IS NECESSARY ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017 http://tplay.pengyichen.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 听雨 < 389625819@qq.com >
// +----------------------------------------------------------------------


namespace app\admin\controller;

use \think\Db;
use \think\Cookie;
use app\admin\model\Accounts as F;//管理员模型
use app\admin\model\AdminMenu;
use app\admin\controller\User;
class Finance extends User
{
    /**
     * 管理员列表
     * @return [type] [description]
     */
    public function index()
    {
        //实列化模型
        $order=new F();
        $where='';
        $whereTime='';
        $post= request()->post();
        //分页bug处理
        $temp_page=request()->param('page');
        if(isset($temp_page)){
            //条件从缓存取出
            $post=Cookie::get('postlist');
        }else{
            //把条件写入缓存
            Cookie::set('postlist',$post);
        }


        if (isset($post['business_way']) and $post['business_way'] > 0) {
            $where['business_way'] = $post['business_way'];
        }
        if (isset($post['creattime']) and !empty( $post['creattime'])) {
            $shi= explode('-',$post['creattime']);
            $start_day = date("YmdHis",strtotime($shi[0]));
            $end_day = date("YmdHis",strtotime("+1 day",strtotime($shi[1])));
            $where['creattime']=['between',[$start_day,$end_day]];
        }
        $date=$order->where($where)->order('accounts_id desc')->paginate(20);
        $this->assign('F',$date);
        $this->assign('wherelist',$post);
        return $this->fetch();
    }

}


